package cn.kgc.musicserver.controller;


import cn.kgc.musicserver.domain.dto.Result;
import cn.kgc.musicserver.domain.dto.ResultUtil;
import cn.kgc.musicserver.domain.entity.Rank;
import cn.kgc.musicserver.service.IRankService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 评价 前端控制器
 * </p>
 *
 * @author zd
 * @since 2025-06-21
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/rank")
public class RankController {
    private final IRankService rankService;
    /**
     * 获取评分列表
     */
    @RequestMapping("page")
    public Result getRankPage(@RequestParam(value = "pageNo", defaultValue = "1") int pageNo,
                              @RequestParam(value = "size", defaultValue = "5") int size) {
        IPage<Rank> page = new Page<>(pageNo, size);
        page = rankService.page(page);
        return ResultUtil.returnDataSuccess(page);
    }

}
